$.ajax({
    type :"GET",
    async : true,
    url : "http://www.easy-mock.com/mock/5a1e77fc15c0e55e41985b44/shopping/bannerList?jsonp_param_name=callback",
    dataType : "jsonp",
    success:function(data){
        $("#carousel").html(template("bannerList",data));
        //图片的轮播
        $("#carousel").html($("#carousel").html()+$("#carousel").html()).css("width",$("#carousel img").outerWidth()*$("#carousel img").length+"px");
        var i = 0;
        function toL(){
            if(i==$("#carousel img").length/2){
                i = 0;
                $("#carousel").css("left",0);
            }
            i++;
            $("#carousel").animate({"left":-i*$("#carousel img").outerWidth()-12+"px"},500,"linear");
        }
        function toR(){
            if(i==0){
                i = $("#carousel img").length/2;
                $("#carousel").css("left",-i*$("#carousel img").outerWidth()-12+"px");
            }
            i--;
            $("#carousel").animate({"left":-i*$("#carousel img").outerWidth()-i*12+"px"},500,"linear");
        }
        var timer = setInterval(toL,2000);
        $("#carousel").children("img").on({"mouseover":function(){
            $("#carousel").children("img").stop(true,true);
            clearInterval(timer);
            $(this).velocity({"scaleX":"1.2","scaleY":"1.2"},500);

        },"mouseout":function(){
            clearInterval(timer);
            $(this).velocity({"scaleX":"1","scaleY":"1"},500);
            timer = setInterval(toL,2000);}
        })
    },
    error : function(XMLHttpRequest, textStatus, errorThrown) {
        var info = "XMLHttpRequest:" + JSON.stringify(XMLHttpRequest)+ " ;textStatus:" + textStatus + "; errorThrown:"+ JSON.stringify(errorThrown) + ";【" + url + "】";
        console.log(info);
    }
})
$.ajax({
    type :"GET",
    async : true,
    url :"http://www.easy-mock.com/mock/5a1e77fc15c0e55e41985b44/shopping/pants_count?jsonp_param_name=callback",
    dataType : "jsonp",
    success:function(count){
        $(".sec_left").html(template("Count",count));
    },
    error : function(XMLHttpRequest, textStatus, errorThrown) {
        var info = "XMLHttpRequest:" + JSON.stringify(XMLHttpRequest)+ " ;textStatus:" + textStatus + "; errorThrown:"+ JSON.stringify(errorThrown) + ";【" + url + "】";
        console.log(info);
    }
})
$.ajax({
    type :"GET",
    async : true,
    url :"http://www.easy-mock.com/mock/5a1e77fc15c0e55e41985b44/shopping/pantsList?jsonp_param_name=callback",
    dataType : "jsonp",
    success:function(sec_right){
        $(".sec_right").html(template("pantsShow",sec_right));
    },
    error : function(XMLHttpRequest, textStatus, errorThrown) {
        var info = "XMLHttpRequest:" + JSON.stringify(XMLHttpRequest)+ " ;textStatus:" + textStatus + "; errorThrown:"+ JSON.stringify(errorThrown) + ";【" + url + "】";
        console.log(info);
    }
})